package com.airbnb.mvrx.sample.views

import android.content.Context
import android.widget.LinearLayout
import android.widget.TextView
import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView
import com.airbnb.epoxy.TextProp
import com.example.mvrxstudy.R

@ModelView(autoLayout = ModelView.Size.MATCH_WIDTH_MATCH_HEIGHT)
class HeaderView @JvmOverloads constructor(context: Context) : LinearLayout(context) {

    private val mTitle: TextView
    private val mCaption: TextView

    init {
        inflate(context, R.layout.view_header, this)
        mTitle = findViewById(R.id.title_text)
        mCaption = findViewById(R.id.caption_text)
    }

    @TextProp
    fun setTitle(title: CharSequence) {
        mTitle.text = title
    }

    @ModelProp
    fun setCaption(caption: CharSequence) {
        mCaption.text = caption
    }


}